#include <gtest/gtest.h>
#include <fstream>
#include <thread>
#include <chrono>

#include "utils_log.h"
#include "utils_init.h"
#include "common_init.h"
#include "nlohmann/json.hpp"
#include "record_record.h"

namespace El {
namespace Record {

class RecordTest : public ::testing::Test {
protected:
    static void SetUpTestSuite()
    {
        // 初始化基础库
        nlohmann::json config;
        config["log_file"] = "app.log";
        El::Utils::base_init(config);

        // 初始化配置
        config.clear();
        config["general"] = "app_config";
        config["default"] = "default_config";
        El::Common::common_init(config);
    }

    void SetUp() override {}

    void TearDown() override {}
};

TEST_F(RecordTest, BasicRecordTest)
{
    IRecord &record = IRecord::GetInstance();
    ASSERT_TRUE(record.StartManual(0));

    // 等待10秒让录像进行
    std::this_thread::sleep_for(std::chrono::seconds(10));

    record.StopManual(0);
}

} // namespace Record
} // namespace El